/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package createTable;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

/**
 *
 * @author BAGUS
 */
public class InsertBarangAsmart {
    public static void main(String[] args) {
        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
        String userid = "mhs115314008"; // gantikan dengan username anda
        String password = "mhs115314008";// gantikan dengan password anda
        try {
            Connection connection = null;
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            ds.setPassword(password);
            ds.setUser(userid);
            connection = (Connection) ds.getConnection();
            Statement statement = connection.createStatement();
            statement.executeQuery("insert into barang_asmart values ('0001','indomie',50,1200)");
            statement.executeQuery("insert into barang_asmart values ('0002','superpel',200,10000)");
            statement.executeQuery("insert into barang_asmart values ('0003','tisue',100,7000)");
            statement.executeQuery("insert into barang_asmart values ('0004','big cola',50,3000)");
            statement.executeQuery("insert into barang_asmart values ('0005','sprite',60,3500)");
            statement.executeQuery("insert into barang_asmart values ('0006','pop mie',52,3500)");
            statement.executeQuery("insert into barang_asmart values ('0007','pepsodent',90,3500)");
            statement.executeQuery("insert into barang_asmart values ('0008','djarum super',50,14000)");
            statement.executeQuery("insert into barang_asmart values ('0009','korek api',60,1000)");
            statement.executeQuery("insert into barang_asmart values ('0010','aqua',50,2000)");
            statement.executeQuery("insert into barang_asmart values ('0011','paddle pop',80,3200)");
            statement.executeQuery("insert into barang_asmart values ('0012','gery chocolatos',45,1500)");
            statement.executeQuery("insert into barang_asmart values ('0013','silver queen',63,7200)");
            statement.executeQuery("insert into barang_asmart values ('0014','lifeboy',51,5400)");
            statement.executeQuery("insert into barang_asmart values ('0015','clear shampoo',96,5000)");
            
            System.out.println("data barang sudah dimasukan");
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
